﻿<UserControl x:Class="ArchivumAeternumDesktop.ListEditor"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="25" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        
        <Label Grid.Row="0" Content="{Binding Title}" />
        <ListBox ItemsSource="{Binding Items}" SelectedItem="{Binding SelectedItem, Mode=TwoWay}" Grid.Row="1" Margin="0,0,0,5" />

        <Grid Grid.Row="2" Visibility="{Binding IsEditorVisible}">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="30" />
                <ColumnDefinition Width="50" />
            </Grid.ColumnDefinitions>
            <TextBox Grid.Column="0" Text="{Binding EditingItem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Stretch" Margin="0,0,0,5" />
            <Button Grid.Column="1" Content="Ok" Command="{Binding OkButton}" Margin="5,0,0,5" HorizontalAlignment="Stretch" />
            <Button Grid.Column="2" Content="Cancel" Command="{Binding CancelButton}" Margin="5,0,0,5" HorizontalAlignment="Stretch" />
        </Grid>
        
        <Grid Grid.Row="3">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="35" />
                <ColumnDefinition Width="35" />
                <ColumnDefinition Width="50" />
            </Grid.ColumnDefinitions>
            <Button Grid.Column="1" Content="Add" Command="{Binding AddButton}" Margin="5,0,0,0" HorizontalAlignment="Stretch" />
            <Button Grid.Column="2" Content="Edit" Command="{Binding EditButton}" Margin="5,0,0,0" HorizontalAlignment="Stretch" />
            <Button Grid.Column="3" Content="Delete" Command="{Binding DeleteButton}" Margin="5,0,0,0" HorizontalAlignment="Stretch" />
        </Grid>
    </Grid>
</UserControl>
